import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { Template } from '../schemas/template.schema';

@Injectable()
export class TemplateSeedService {
  constructor(
    @InjectModel(Template.name) private templateModel: Model<Template>,
  ) { }

  async seed() {
    // 清空现有数据
    await this.templateModel.deleteMany({});
    console.log('模板数据已成功清空！');

    // 示例数据
    const templates = [
      {
        ID: "82e5349c-e404-457b-a9f6-d5803ffb9dbc",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1662295065883-1739268178947.png",
        NAME: "template6",
        EMAIL: "1584775297@qq.com",
        LIKES: 110,
        VIEWS: 15193,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 397
      },
      {
        ID: "db27711a-597b-4c95-8c52-46cf6c56c93e",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-08 150756-1665212969268.png",
        NAME: "template2",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 13098,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 209
      },
      {
        ID: "d8f0896b0590498fa70f7d51070102b1",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1663312436666.png",
        NAME: "customJson",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 8614,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 250
      },
      {
        ID: "f1026354-972d-4219-b2e3-fcd90525d3e1",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1662294917702-1739268279349.png",
        NAME: "template3",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 6508,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 100
      },
      {
        ID: "1",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1662989795192.png",
        NAME: "template1",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 4545,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 54
      },
      {
        ID: "2548ed667e5b449b9f6e59ad62c3b21a",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2025-02-11_18-07-18-1739268453629.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 4363,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 70
      },
      {
        ID: "4b57633a3d734121a94fbefd0f910f7d",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2025-02-11_18-07-54-1739268483898.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 2740,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 44
      },
      {
        ID: "db9a1a206d07416d820b2eca31793965",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-11-08 191306-1667908266106.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 2290,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 57
      },
      {
        ID: "08cdc5ee55184303980354f361b323a6",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1663146631921.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 1774,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 32
      },
      {
        ID: "b54330d576164c85b393a9c6adee823b",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/1-1663830622711.png",
        NAME: "customJson",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 1099,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 24
      },
      {
        ID: "c558bd0f97934293893b74bd126bc5f4",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1663315601969.png",
        NAME: "customJson",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 809,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 16
      },
      {
        ID: "8a9592970d1a40b9aeed5917d48a3688",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-19 203030-1666184107350.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 740,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 3
      },
      {
        ID: "92d07cb31a2547168f10289ebf75718e",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2025-02-11_18-06-00-1739268403959.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 735,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 20
      },
      {
        ID: "e43feead-6b29-42bb-aef5-ac433f930655",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2025-02-11_18-05-14-1739268330249.png",
        NAME: "template4",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 643,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 8
      },
      {
        ID: "61f503e35e9942568b1c578958da2d79",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1663290408795.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 593,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 15
      },
      {
        ID: "6e758078-8842-4999-adfc-5dbf43d358ee",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2025-02-11_18-06-00-1739268368931.png",
        NAME: "template5",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 561,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 2
      },
      {
        ID: "1b36e194f13d4f278d55bc1af41f2a1e",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-09-22 145033-1663829470221.png",
        NAME: "customJson",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 530,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 4
      },
      {
        ID: "db400a6a7468486d8fe8ecd494e04961",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/file-1663146282454.png",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 524,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 13
      },
      {
        ID: "ec5c9b27645d4be3ae003cc6d7ae8823",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-19 210034-1666184447970.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 496,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 7
      },
      {
        ID: "ab7796e694e94ebcae722a5a38f49a4c",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2022-11-30_21-05-46-1669813559580.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 465,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 2
      },
      {
        ID: "91dd8a27828e40a5905a996095753cd6",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-19 205806-1666184295700.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 374,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 0
      },
      {
        ID: "f1cfa8b7efaf45f2bcf2b02ed5f36d72",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-11-30 213427-1669815282280.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 328,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 0
      },
      {
        ID: "6fa2926cddcf4ae4a77a45e13cd3a279",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2024-01-31_20-36-34-1706704604323.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 327,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 3
      },
      {
        ID: "f70f92c8ee4f4070acde02bdaade6cf2",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-19 204240-1666183371578.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 324,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 2
      },
      {
        ID: "618097da971d47fc99664ac5a05a4667",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/屏幕截图 2022-10-19 210517-1666184728602.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 262,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 0
      },
      {
        ID: "6906cc06b34c4307bf6580b95d669b6e",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/2-1663830641551.png",
        NAME: "customJson",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 256,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 0
      },
      {
        ID: "e37aac6d302b4139b25d65aba3cb81a4",
        previewUrl: "https://maobucv.com:9000/resume/templatePreview/Snipaste_2024-02-01_19-57-30-1706788661889.png",
        NAME: "",
        EMAIL: "1584775297@qq.com",
        LIKES: 0,
        VIEWS: 88,
        userInfo: {
          name: "会飞的猪",
          userId: "6336dffcf585c7b262fa1db2",
          avatar: "https://maobucv.com:9000/resume/avatar/anime-pictures.net-1723725376564.ico"
        },
        commentCount: 2
      }
    ];

    // 插入数据
    await this.templateModel.insertMany(templates);
    console.log('模板数据已成功插入！');
  }
} 